<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>查询</title>
    <script src="http://localhost:10000/js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="http://localhost:10000/js/guohu.js" type="text/javascript"></script>
    <style>
        table{
            border: 1px solid;
            border-collapse: collapse;
        }
        td{
            border: 1px solid;
        }
    </style>
</head>
<body>
<div>
    <form action="selectTransfer.do" id="form1">
        <table>
            <tr>
                <td>交易时间</td>
                <td colspan="2">
                    <input type="date" name="date1" id="date1" th:value="${session.guohudate1}"/>
                    /
                    <input type="date" name="date2" id="date2" th:value="${session.guohudate2}"/>
                </td>
            </tr>
            <tr>
                <td>买家</td>
                <td colspan="2"><input type="text" name="transferBuyer" id="maija" th:value="${session.guohmaij}"/></td>
            </tr>
            <tr>
                <td>卖家</td>
                <td colspan="2"><input type="text" name="transferVender" id="maja" th:value="${session.guohmaija}"/></td>
            </tr>
            <tr>
                <td><input type="hidden" th:value="${session.size}"/></td>
                <td colspan="2"><input type="submit" value="查询" id="chaxun"></td>
            </tr>
        </table>
    </form>
</div>
<div>
    <table style="width: 100%" th:if="${session.guohupageInfo != null}">
        <tr>
            <td colspan="6">没有找到记录</td>
        </tr>
        <tr>
            <td>过户单号</td>
            <td>买方</td>
            <td>卖方</td>
            <td>操作员</td>
            <td>过户时间</td>
            <td>最后编辑的时间</td>
        </tr>
        <tr th:each="everyT:${session.guohupageInfo.list}">
            <td th:text="${everyT.transferID}"></td>
            <td th:text="${everyT.transferBuyer}"></td>
            <td th:text="${everyT.transferVender}"></td>
            <td th:text="${everyT.userID}"></td>
            <td th:text="${everyT.transferDate}"></td>
            <td th:text="${everyT.transferEditTime}"></td>
        </tr>
        <input type="hidden" id="num" th:value="${session.num156}"/>
        <input type="hidden" id="size" th:value="${session.size156}"/>

        <tr>
            <button type="button" th:value="${session.guohupageInfo.getPageNum()>1?session.guohupageInfo.getPageNum()-1:session.guohupageInfo.getPageNum()}"
                    onclick="lastpage(this.value)">上一页
            </button>

            <select name="pageSize" id="pageSize" onchange="getpage1(this.value)">
                <option value="5" th:selected="${session.size156 == 5}">5</option>
                <option value="10" th:selected="${session.size156 == 10}">10</option>
                <option value="15" th:selected="${session.size156 == 15}">15</option>
            </select>

            <button type="button" th:value="${session.guohupageInfo.getPageNum()<session.guohupageInfo.getPages()?session.guohupageInfo.getPageNum()+1:session.guohupageInfo.getPageNum()}"
                    onclick="lastpage(this.value)">下一页
            </button>
        </tr>
    </table>
</div>
</body>
<script type="text/javascript">
    function getpage1(page) {
        var transferBuyer = $("#maija").val();
        var transferVender = $("#maja").val();
        var date1 = $("#date1").val();
        var date2 = $("#date2").val();
        var pageNum = $("#num").val();
        var size = $("#size").val();
        window.location = "/guohu/selectTransfer.do?transferBuyer=" + transferBuyer+"&transferVender="+transferVender+ "&date1=" + date1 + "&date2=" + date2 + "&pageNum="+pageNum+"&pageSize="+page;
    }


    function lastpage(page) {

        var transferBuyer = $("#maija").val();
        var transferVender = $("#maja").val();
        var pageSize = $("#pageSize").val();
        var date1 = $("#date1").val();
        var date2 = $("#date2").val();
        console.log(transferBuyer + '&'+transferVender+'&'+ date1 + '-' + date2 + '&' + pageSize);
        window.location = "/guohu/selectTransfer.do?transferBuyer=" + transferBuyer+"&transferVender="+transferVender+ "&date1=" + date1 + "&date2=" + date2 + "&pageNum=" + page + "&pageSize=" + pageSize;
    }
</script>
</html>